<?php
//热点页面
require 'lib.php';
include('header.php');
//1.判断是否登录
if( !($user = isLogin()) ) {
    header('Location: index.php');exit(0);
}
//2.取出最新注册的用户
$redis = redis_conn();
$user_list = $redis->sort('newuserlist',array('sort' => 'desc', 'get' => 'user:userid:*:username'));

?>

    <h2>热点</h2>
    <i>最新注册用户(redis中的sort用法)</i><br>
    <div>
        <?php foreach ($user_list as $uv) { ?>
        <a class="username" href="profile.php?u=<?php echo $uv?>"><?php echo $uv?></a>
        <?php }?>
    </div>

    <br><i>最新的50条微博!</i><br>
    <div class="post">
        <a class="username" href="profile.php?u=test">test</a>
        world<br>
        <i>22 分钟前 通过 web发布</i>
    </div>

    <div class="post">
        <a class="username" href="profile.php?u=test">test</a>
        hello<br>
        <i>22 分钟前 通过 web发布</i>
    </div>

<?php include 'footer.php' ?>